package net.xiduth.game.player.dialogues.auto;

import net.xiduth.game.player.controlers.dung.DungLobby;
import net.xiduth.game.player.dialogues.Dialogue;

/**
 * 
 * @author Jae
 * 
 * Handles leaving the instance.
 *
 */

public class EnteringDung extends Dialogue {

	@Override
	//compilee
	public void start() {
		stage = 1;
		if (stage == 1) {
			sendOptionsDialogue("Would you like to enter the lobby?",
					"Yes please.",
					"No thanks.",
					"Lobby information.",
					"How many tokens do I have?");
			stage = 1;
	}
	}

	public void run(int interfaceId, int componentId) {
		if (stage == 1) {
			if (componentId == OPTION_1) {
				player.getBank().depositAllEquipment(false);
				player.getBank().depositAllInventory(false);
				player.getControlerManager().startControler(
						"RuneDungLobby", 1);
				stage= 2;
			}
			if (componentId == OPTION_2) {
				stage = 2;				
		}
			if (componentId == OPTION_3) {
				player.getDialogueManager().startDialogue("SimpleMessage", "There are currently " 
			+ DungLobby.getLobby().getPlayerSize() + " players in the lobby.");
				stage = 1;
		}
			if (componentId == OPTION_4) {
				player.getDialogueManager().startDialogue("SimpleMessage", "You currently have " 
			+ player.getDungTokens() + " tokens.");
				stage = 1;
		}
		}
		if (stage == 2) {
			end();
			player.getInterfaceManager().closeChatBoxInterface();
		}
	}

	@Override
	public void finish() {

	}

}